import {HeaderState} from '../../interface';
import {actionsType} from '../../store';

const initState: HeaderState = {
    focused: false
}

export const headerReducer = (state = initState, action: any) => {
    const newState: HeaderState = JSON.parse(JSON.stringify(state));
    switch (action.type) {
        case actionsType.SEARCH_FOCUS:
            newState.focused = true;
            return newState;
        case actionsType.SEARCH_BLUR:
            newState.focused = false;
            return newState;
        default:
            return newState;
    }
}